#!usr/bin/evn python
# -*- coding： UTF-8-*-

import os
from typing import Annotated, Any, Literal

from pydantic import AnyHttpUrl, BeforeValidator
from pydantic_settings import BaseSettings, SettingsConfigDict

class Settings(BaseSettings):
    model_config = SettingsConfigDict(
        env_file=os.getenv('BACKEND_ENV_FILE', '.env'),
        env_ignore_empty=True,
        extra='ignore',
        frozen=True,
    )

    ENVIRONMENT: Literal['local', 'unittest', 'test', 'prod'] = 'prod'

    CLIENT_TZ: str = "Asia/Shanghai"
    SECRET_KEY: str = "Xj&520WlMq#"  # Token加密秘钥

    # 微信APP（正式个人主体微信小游戏）
    APP_ID: str = "wx86abd27dfeae2ea9"
    APP_SECRET: str = "78838fd8aeacb0e1b4d4d821aacb984d"

    # Redis缓存
    CACHE_REDIS_HOST: str = "localhost"
    CACHE_REDIS_PORT: int = 6379
    CACHE_REDIS_DB: int = 0
    CACHE_REDIS_PWD: str = "XjZhy2048360"

    # MongoDB
    MONGODB_URI: str = "mongodb://localhost:27017/"
    MONGODB_DB_NAME: str = "test_db"
    MONGODB_USERNAME: str = "game_user"  # MongoDB 用户名
    MONGODB_PASSWORD: str = "secure_password"  # MongoDB 密码


settings = Settings()